package com.dzt.androidframework.express;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;

import com.dzt.androidframework.R;
import com.dzt.androidframework.express.javabean.OrderState;
import com.dzt.androidframework.fragment.FragmentAdapter;
import com.dzt.androidframework.fragment.FragmentBase;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;

/**
 * Created by M02323 on 2017/9/18.
 */

@ContentView(R.layout.fragment_bill)
public class FragmentBill extends FragmentBase implements TabLayout.OnTabSelectedListener {
	@ViewInject(R.id.tl)
	private TabLayout tabLayout;
	@ViewInject(R.id.viewpager)
	private ViewPager viewPager;

	@Override
	protected void initWidgets() {
		tabLayout.addOnTabSelectedListener(this);
		FragmentAdapter adapter = new FragmentAdapter(getActivity().getSupportFragmentManager());
		adapter.addFragment(FragmentOrder.newInstance(OrderState.TYPE_ALL), "全部");
		adapter.addFragment(FragmentOrder.newInstance(OrderState.TYPE_SIGNED), "已签收");
		adapter.addFragment(FragmentOrder.newInstance(OrderState.TYPE_UNSIGNED), "未签收");
		viewPager.setAdapter(adapter);
		tabLayout.setupWithViewPager(viewPager);
	}

	@Override
	public void onDestroyView() {
		super.onDestroyView();
		tabLayout.removeOnTabSelectedListener(this);
	}

	@Override
	public void onTabSelected(TabLayout.Tab tab) {

	}

	@Override
	public void onTabUnselected(TabLayout.Tab tab) {

	}

	@Override
	public void onTabReselected(TabLayout.Tab tab) {

	}
}
